import { apiGet, apiPost } from './api'

//获取轮播图列表
export const getSwiper = (query) => {
  return new Promise((resolve, reject) => {
    apiPost('https://goods.zzgoodqc.cn/index.php/index/hao/getImgList', query)
      .then((res) => {
        resolve(res)
      })
      .catch((err) => {
        reject(err)
      })
  })
}
//删除图片
export const delpic = (query) => {
  return new Promise((resolve, reject) => {
    apiGet('https://goods.zzgoodqc.cn/index.php/index/hao/delBanners', query)
      .then((res) => {
        resolve(res)
      })
      .catch((err) => {
        reject(err)
      })
  })
}
//获取图片链接
export const getImgUrl = (query) => {
  return new Promise((resolve, reject) => {
    apiPost('https://goods.zzgoodqc.cn/index.php/index/upload/uploadimg', query)
      .then((res) => {
        resolve(res)
      })
      .catch((err) => {
        reject(err)
      })
  })
}
//添加图片
export const addImgs = (query) => {
  return new Promise((resolve, reject) => {
    apiPost('https://goods.zzgoodqc.cn/index.php/index/hao/addImgs', query)
      .then((res) => {
        resolve(res)
      })
      .catch((err) => {
        reject(err)
      })
  })
}
